#include<stdio.h>
#include<stdlib.h>
void main(){
    FILE * fp1,* fp2;
    char str[20];
    fp1=fopen("text.txt","r");
    if(fp1==NULL){
        printf("文件text.txt打开错误\n");
        exit(0);
    }
    fp2=fopen("result.txt","w");
    if(fp2==NULL){
        printf("文件result.txt创建错误\n");
        exit(0);
    }
    while(fgets(str,20,fp1)!=NULL){
        fputs(str,fp2);
        printf("%s",str);
    }
    printf("\n");
    fclose(fp1);
    fclose(fp2);
}